using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Lzfy_His_Service.Models
{
    /// <summary>
    /// 电脑软件信息详细表
    /// 存储电脑软件安装的详细信息，按MAC地址进行关联
    /// </summary>
    [Table("Lzfy_PcSoft_Detail")]
    public class PcSoftwareInfo
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        /// <summary>
        /// 录入时间
        /// </summary>
        [Column("input_date")]
        public DateTime? InputDate { get; set; }

        /// <summary>
        /// 软件名称
        /// </summary>
        [Required]
        [MaxLength(200)]
        [Column("Name")]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 软件版本号
        /// </summary>
        [MaxLength(100)]
        [Column("Version")]
        public string? Version { get; set; }

        /// <summary>
        /// 软件发布商
        /// </summary>
        [MaxLength(100)]
        [Column("Publisher")]
        public string? Publisher { get; set; }

        /// <summary>
        /// 软件安装日期（原始字符串格式）
        /// </summary>
        [MaxLength(50)]
        [Column("InstallDate")]
        public string? InstallDate { get; set; }

        /// <summary>
        /// 软件安装路径
        /// </summary>
        [MaxLength(500)]
        [Column("InstallLocation")]
        public string? InstallLocation { get; set; }

        /// <summary>
        /// 软件信息来源（如32位/64位注册表）
        /// </summary>
        [MaxLength(50)]
        [Column("Source")]
        public string? Source { get; set; }

        /// <summary>
        /// MAC地址
        /// </summary>
        [MaxLength(50)]
        [Column("MACAddress")]
        public string? MACAddress { get; set; }
    }

    /// <summary>
    /// 按MAC地址分组的软件信息响应模型
    /// </summary>
    public class PcSoftwareInfoResponse
    {
        /// <summary>
        /// MAC地址
        /// </summary>
        public string MACAddress { get; set; } = string.Empty;

        /// <summary>
        /// 该MAC地址下的软件列表
        /// </summary>
        public List<PcSoftwareInfo> SoftwareList { get; set; } = new List<PcSoftwareInfo>();

        /// <summary>
        /// 软件总数
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 数据最后更新时间
        /// </summary>
        public DateTime? LastUpdateTime { get; set; }
    }

    /// <summary>
    /// 根据MAC地址查询软件信息请求模型
    /// </summary>
    public class GetByMacAddressRequest
    {
        /// <summary>
        /// MAC地址
        /// </summary>
        [Required(ErrorMessage = "MAC地址不能为空")]
        public string MacAddress { get; set; } = string.Empty;
    }

    /// <summary>
    /// 电脑软件信息查询请求模型
    /// </summary>
    public class PcSoftwareQueryRequest
    {
        /// <summary>
        /// MAC地址（可选）
        /// </summary>
        public string? MACAddress { get; set; }

        /// <summary>
        /// 软件名称（可选，支持模糊查询）
        /// </summary>
        public string? SoftwareName { get; set; }

        /// <summary>
        /// 页码（默认为1）
        /// </summary>
        public int? PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页大小（默认为10）
        /// </summary>
        public int? PageSize { get; set; } = 10;
    }

    /// <summary>
    /// 获取软件统计信息请求模型
    /// </summary>
    public class GetSoftwareStatisticsRequest
    {
        /// <summary>
        /// MAC地址
        /// </summary>
        [Required(ErrorMessage = "MAC地址不能为空")]
        public string MacAddress { get; set; } = string.Empty;
    }
}